import { request, upload } from "./base"
export default {
  registerCompany(data) {
    return request("trade/openApi/registerCompany", "post", data)
  },
  login(data) {
    return request("auth/oauth/mobile", "post", data)
  },
  // login(data) {
  //   return request("auth/oauth/login", "post", data)
  // },
  getMyInfo() {
    return request("admin/user/myInfo", "get")
  },
  sendSms(mobile, type) {
    return request(`admin/file/sendSms/${mobile}/${type}`, "get")
  },
  getMarketUser(data) {
    return request(`trade/marketUser/page`, "post", data)
  },
  uploadImage(file) {
    return upload(`admin/file/uploadImage`, file)
  },
  // 创建交易市场用户
  addMarketUser(data) {
    return request(`trade/marketUser/create`, "post", data)
  },
  // 查看交易市场用户详细信息
  getUserInfo(id) {
    return request(`trade/marketUser/info/${id}`, "get")
  },
  // 创建意见反馈
  insertAdvice(data) {
    return request(`assist/advice/insertAdvice`, "post", data)
  },
  // 解绑市场用户角色
  deleteMarketUser(data) {
    return request(`trade/marketUser/marketUsersUnBindRole`, "post", data)
  },
  // 查看我的交易市场用户详细信息(查询具体公司)
  getMyUserInfo(companyId) {
    if (companyId >= 0) {
      return request(`trade/marketUser/myInfo/${companyId}`, "get")
    } else {
      return request(`trade/marketUser/myInfo`, "get")
    }
  },
  // 更新手机号码
  updatePhone(newPhone, verification) {
    return request(`trade/marketUser/updatePhone/${newPhone}/${verification}`, "post")
  },
  // 更新交易市场用户(市场管理员管理市场农户)
  updateMarketUser(data) {
    return request(`trade/marketUser/update`, "post", data)
  }
}
